#ifndef __CMD_H__
#define __CMD_H__
#include "Net.h"
#include "define_stl.h"
#include "define_type.h"
using namespace std;
//宏定义------------------------------------
#define _PKG_MAX_LENGTH     30000  //每个包的最大长度【包头+包体】不超过这个数字，为了留出一些空间，实际上编码是，包头+包体长度必须不大于 这个值-1000【29000】
#define   JSON_MAX_LEN  2500
 
/* 命令类型定义 */
enum _CMD_TYPE_IOT
{
	Cmd_Register_D2S_py = 0x1000,
	Cmd_Login_D2S_py,
	Cmd_Heart_D2S_py,



	//
	Cmd_Register_C2S = 0x8002,
	Cmd_Login_C2S = 0x8003,
	Cmd_LoginSet_S2C = 0x8004,

	Cmd_Heart_C2S = 0x8000,
	Cmd_HeartSet_S2C = 0x8001,

	Cmd_DeviceHeart = 0x0000,
	Cmd_SetDeviceHeart = 0x0001,

	Cmd_DeviceRegister = 0x0002,

	Cmd_DeviceLogin = 0x0003,
	Cmd_SetDeviceLogin = 0x0004,




	//设备开关动作
	Cmd_DeviceOpenOffUpdate_D2S = 0x0200,
	Cmd_SetDeviceOpenOff_S2D = 0x0201,
	Cmd_GetDeviceOpenOff_S2D = 0x0202,

	Cmd_Update_InputStateOnOff_D2S = 0x0207,	//上报输入状态；
	Cmd_Get_InputStateOnOff_S2D = 0x0208,			//查询输入状态；

	//开关操作命令PC
	Cmd_DeviceOpenOffUpdate_S2C = 0x8200,
	Cmd_SetDeviceOpenOff_C2S = 0x8201,
	Cmd_GetDeviceOpenOff_C2S = 0x8202,

	Cmd_Update_InputStateOnOff_S2C = 0x8207, //服务器上报输入状态；
	Cmd_Get_InputStateOnOff_C2S = 0x8208,      //客户端查询输入状态；

	Cmd_SetDeviceOpenOffDec_C2S = 0x8203,
	Cmd_GetDeviceOpenOffDec_C2S = 0x8204,

	Cmd_SetDeviceOpenOffDeviceLable_C2S = 0x8205,
	Cmd_GetDeviceOpenOffDeviceLable_C2S = 0x8206,

	Cmd_SetInputOpenOffDeviceLable_C2S = 0x8209,
	Cmd_GetInputOpenOffDeviceLable_C2S = 0x820A,

	//节目操作
	Cmd_DeviceProgramUpdate_D2S = 0x0100,
	Cmd_UpdateProgramState_S2C = 0x8100,

	Cmd_SetDeviceProgram_S2D = 0x0101,
	Cmd_SetDeviceProgram_C2S = 0x8101,

	Cmd_GetDeviceProgram_S2D = 0x0102,
	Cmd_GetDeviceProgram_C2S = 0x8102,

	Cmd_SetDeviceSubDec_C2S = 0x8103,
	Cmd_GetDeviceSubDec_C2S = 0x8104,
	Cmd_SetProgramSubDec_C2S = 0x8105,
	Cmd_GetProgramSubDec_C2S = 0x8106,

	//cmd_type0301

	Cmd_SendOnOff_S2D_0301 = 0x0300,         //发送开关机
	Cmd_SendLock_S2D_0301 = 0x0301,			 //UID		0	1		1锁 / 0解锁	sumH	sumL	发送上锁指令

	Cmd_GetPortConfig_S2D_0301 = 0x0302,	 //UID		0	0	sumH	sumL	查询端口配置
	Cmd_UpdatePortConfig_D2S_0301 = 0x0303,//UID		0	24	deviceModel[24]	sumH	sumL	上报开端口配置

	Cmd_GetPortStatus_S2D_0301 = 0x0304,	//UID		0	0		sumH	sumL	查询端口状态
	Cmd_UpdatePortStatus_D2S_0301 = 0x0305,//		0	24	deviceStatus[24]	sumH	sumL	上报开端口状态

	Cmd_SetTime_S2D_0301 = 0x0306,			   //UID		0	7	年月日时分秒[星期几]	sumH	sumL	设置当前时间
	Cmd_UpdateTime_D2S_0301 = 0x0307,		//UID		0	7	年月日时分秒[星期几]	sumH	sumL	上报当前时间
	Cmd_GetTime_S2D_0301 = 0x0308,			//UID		0	0		sumH	sumL	查询当前时间

	Cmd_SetStartupTime_S2D_0301 = 0x0309,	//UID		0	7	年月日时分秒[星期几]	sumH	sumL	设置开机时间
	Cmd_UpdateStartupTime_D2S_0301 = 0x030A,//UID		0	7	年月日时分秒[星期几]	sumH	sumL	上报开机时间
	Cmd_GetStartupTime_S2D_0301 = 0x030B,	//UID		0	0		sumH	sumL	查询开机时间


	Cmd_SetTurnOffTime_S2D_0301 = 0x030C,	//UID		0	7	年月日时分秒[星期几]	sumH	sumL	设置关机时间
	Cmd_UpdateTurnOffTime_D2S_0301 = 0x030D,//		0	7	年月日时分秒[星期几]	sumH	sumL	上报关机时间
	Cmd_GetTurnOffTime_S2D_0301 = 0x030E,	//UID		0	0		sumH	sumL	查询关机时间

	Cmd_SetPowerOnTimerBool_S2D_0301 = 0x030F,//	UID		0	1		1使能 / 0关闭	sumH	sumL	设置定时开关机使能
	Cmd_UpdatePowerOnTimerBool_D2S_0301 = 0x0310,//		UID		0	1		1使能 / 0关闭	sumH	sumL	上报开关机使能
	Cmd_GetPowerOnTimerBool_S2D_0301 = 0x0311,	//		UID		0	0		sumH	sumL	查询开关机使能

	Cmd_RemoteUpgrade_S2D_0301 = 0x0312,		//UID		lenH		lenL	按照ArtFirmwareMaster格式	sumH	sumL	远程升级
	Cmd_GetSensor_S2D_0301 = 0x0317,
	Cmd_UpdateSensor_D2S_0301 = 0x0318,

	Cmd_SendOnOff_C2S_0301 = 0x8300,

	Cmd_SendLock_C2S_0301 = 0x8301,

	Cmd_GetPortConfig_C2S_0301 = 0x8302,

	Cmd_UpdatePortConfig_S2C_0301 = 0x8303,

	Cmd_GetPortStatus_C2S_0301 = 0x8304,

	Cmd_UpdatePortStatus_S2C_0301 = 0x8305,


	Cmd_SetTime_C2S_0301 = 0x8306,
	Cmd_UpdateTime_S2C_0301 = 0x8307,
	Cmd_GetTime_C2S_0301 = 0x8308,

	Cmd_SetStartupTime_C2S_0301 = 0x8309,
	Cmd_UpdateStartupTime_S2C_0301 = 0x830A,
	Cmd_GetStartupTime_C2S_0301 = 0x830B,

	Cmd_SetTurnOffTime_C2S_0301 = 0x830C,

	Cmd_UpdateTurnOffTime_S2C_0301 = 0x830D,

	Cmd_GetTurnOffTime_C2S_0301 = 0x830E,


	Cmd_SetPowerOnTimerBool_C2S_0301 = 0x830F,

	Cmd_UpdatePowerOnTimerBool_S2C_0301 = 0x8310,

	Cmd_GetPowerOnTimerBool_C2S_0301 = 0x8311,


	Cmd_RemoteUpgrade_C2S_0301 = 0x8312,

	Cmd_SetDeviceLable_C2S_0301 = 0x8313,

	Cmd_GetDeviceLable_C2S_0301 = 0x8314,

	Cmd_SetPortLable_C2S_0301 = 0x8315,

	Cmd_GetPortLable_C2S_0301 = 0x8316,

	Cmd_GetSensor_C2S_0301 = 0x8317,
	Cmd_UpdateSensor_S2C_0301 = 0x8318,

	//原始透传不用改；
	Cmd_PassThrough_S2D_TouYing = 0x03FF,
	Cmd_PassThrough_C2S_TouYing = 0x83FF,   //过滤
//带时间戳透传 投影,电源网关
Cmd_PassThrough_C2S_Time_Encry_TouYing = 0x83FE,
//公共透传指令
Cmd_PassThrough_S2D_public = 0x00FF,		//

Cmd_PassThrough_C2S_public = 0x80FF,		//调用原始透传，//解密过滤

Cmd_PassThrough_C2S_public_time_Encry = 0x80FE,	//带时间戳加密
//电源网关
Cmd_PassThrough_S2D_OnOff = 0x02FF,
Cmd_PassThrough_C2S_OnOff = 0x82FF,
Cmd_PassThrough_C2S_Time_Encry_OnOff = 0x82FE,

Cmd_GetDeviceVersion_S2D = 0x0005,
Cmd_GetDeviceVersion_C2S = 0x8005,
Cmd_DeviceUpdateVersion_D2S = 0x0006,
/**********************电源网关新增******************/
//系统时间;
Cmd_PowerGateway_Time_S2D_Set = 0x020B,
Cmd_PowerGateway_Time_D2S_update = 0x020C,
Cmd_PowerGateway_Time_S2D_Get = 0x020D,

Cmd_PowerGateway_Time_C2S_Set = 0x820B,
Cmd_PowerGateway_Time_S2C_update = 0x820C,
Cmd_PowerGateway_Time_C2S_Get = 0x820D,
//第N路开机时间
Cmd_PowerGateway_OnTime_N_S2D_Set = 0x020E,
Cmd_PowerGateway_OnTime_N_D2S_update = 0x020F,
Cmd_PowerGateway_OnTime_N_S2D_Get = 0x0210,

Cmd_PowerGateway_OnTime_N_C2S_Set = 0x820E,
Cmd_PowerGateway_OnTime_N_S2C_update = 0x820F,
Cmd_PowerGateway_OnTime_N_C2S_Get = 0x8210,
//关机时间
Cmd_PowerGateway_OffTime_N_S2D_Set = 0x0211,
Cmd_PowerGateway_OffTime_N_D2S_update = 0x0212,
Cmd_PowerGateway_OffTime_N_S2D_Get = 0x0213,

Cmd_PowerGateway_OffTime_N_C2S_Set = 0x8211,
Cmd_PowerGateway_OffTime_N_S2C_update = 0x8212,
Cmd_PowerGateway_OffTime_N_C2S_Get = 0x8213,
//设置第N路开关机使能
Cmd_PowerGateway_PowerOn_N_S2D_Set = 0x0214,
Cmd_PowerGateway_PowerOn_N_D2S_update = 0x0215,
Cmd_PowerGateway_PowerOn_N_S2D_Get = 0x0216,

Cmd_PowerGateway_PowerOn_N_C2S_Set = 0x8214,
Cmd_PowerGateway_PowerOn_N_S2C_update = 0x8215,
Cmd_PowerGateway_PowerOn_N_C2S_Get = 0x8216,
//控制模式；
Cmd_PowerGateway_ContrlMode_S2D_Set = 0x021A,
Cmd_PowerGateway_ContrlMode_S2D_Get = 0x021B,
Cmd_PowerGateway_ContrlMode_D2S_update = 0x021C,

Cmd_PowerGateway_ContrlMode_C2S_Set = 0x821A,
Cmd_PowerGateway_ContrlMode_C2S_Get = 0x821B,
Cmd_PowerGateway_ContrlMode_S2C_update = 0x821C,
//锁
//Cmd_PowerGateway_Lock_N_C2S_Set = 0x8217,
//Cmd_PowerGateway_Lock_N_C2S_Get4 = 0x8218,

Cmd_PowerGateway_Lock_S2D_Set = 0x0217,
Cmd_PowerGateway_Lock_S2D_Get = 0x0218,
Cmd_PowerGateway_Lock_D2S_update = 0x0219,

Cmd_PowerGateway_Lock_C2S_Set = 0x8217,
Cmd_PowerGateway_Lock_C2S_Get = 0x8218,
Cmd_PowerGateway_Lock_S2C_update = 0x8219,


Cmd_PowerGateway_Voltage_D2S_update = 0x021D,

Cmd_PowerGateway_Voltage_S2C_update = 0x821D,
Cmd_PowerGateway_Voltage_C2S_Get = 0x821E,
/**********************end*******************************/
//电脑硬件网关
Cmd_Device_Kz027_D2S_UpdateComputerStatus = 0x0500,
Cmd_Device_Kz027_S2D_GetComputerStatus = 0x0501,
Cmd_Device_Kz027_D2S_SendCmd = 0x0502,
Cmd_Device_Kz027_D2S_SelfBootUpdate = 0x0503,
Cmd_Device_Kz027_S2D_SelfBootGet = 0x0504,
Cmd_Device_Kz027_S2D_SelfBootSet = 0x0505,

Cmd_Device_Kz027_S2C_UpdateComputerStatus = 0x8500,
Cmd_Device_Kz027_C2S_GetComputerStatus = 0x8501,
Cmd_Device_Kz027_C2S_SendCmd = 0x8502,
Cmd_Device_Kz027_S2C_SelfBootUpdate = 0x8503,
Cmd_Device_Kz027_C2S_SelfBootGet = 0x8504,
Cmd_Device_Kz027_C2S_SelfBootSet = 0x8505,
//2021-10-11新增
Cmd_Device_Kz027_BootTime_S2D_Set = 0x0506,
Cmd_Device_Kz027_BootTime_D2S_update = 0x0507,
Cmd_Device_Kz027_BootTime_S2D_Get = 0x0508,

Cmd_Device_Kz027_OffTime_S2D_Set = 0x0509,
Cmd_Device_Kz027_OffTime_D2S_update = 0x050A,
Cmd_Device_Kz027_OffTime_S2D_Get = 0x050B,

Cmd_Device_Kz027_PowerOnTimer_S2D_Set = 0x050C,
Cmd_Device_Kz027_PowerOnTimer_D2S_update = 0x050D,
Cmd_Device_Kz027_PowerOnTimer_S2D_Get = 0x050E,

Cmd_Device_Kz027_SysTime_S2D_Set = 0x050F,
Cmd_Device_Kz027_SysTime_D2S_update = 0x0510,

Cmd_Device_Kz027_Voltage_D2S_update = 0x0512,
Cmd_Device_Kz027_Mode_S2D_Set = 0x0514,
Cmd_Device_Kz027_Mode_S2D_Get = 0x0515,
Cmd_Device_Kz027_Mode_D2S_update = 0x0516,


//C开机时间
Cmd_Device_Kz027_BootTime_C2S_Set = 0x8506,
Cmd_Device_Kz027_BootTime_S2C_update = 0x8507,
Cmd_Device_Kz027_BootTime_C2S_Get = 0x8508,
//关机时间
Cmd_Device_Kz027_OffTime_C2S_Set = 0x8509,
Cmd_Device_Kz027_OffTime_S2C_update = 0x850A,
Cmd_Device_Kz027_OffTime_C2S_Get = 0x850B,
//定时使能
Cmd_Device_Kz027_PowerOnTimer_C2S_Set = 0x850C,
Cmd_Device_Kz027_PowerOnTimer_S2C_update = 0x850D,
Cmd_Device_Kz027_PowerOnTimer_C2S_Get = 0x850E,
//对时
Cmd_Device_Kz027_SysTime_C2S_Set = 0x850F,
Cmd_Device_Kz027_SysTime_S2C_update = 0x8510,
Cmd_Device_Kz027_SysTime_C2S_Get = 0x8511,

Cmd_Device_Kz027_Voltage_S2C_update = 0x8512,
Cmd_Device_Kz027_Voltage_C2S_Get = 0x8513,
Cmd_Device_Kz027_Mode_C2S_Set = 0x8514,
Cmd_Device_Kz027_Mode_C2S_Get = 0x8515,
Cmd_Device_Kz027_Mode_S2C_update = 0x8516,

//电脑软件网关
Cmd_ComputerSoftwareGateWay_SendDataD2S = 0x0400,
Cmd_ComputerSoftwareGateWay_SendDataS2D = 0x0401,
Cmd_ComputerSoftwareGateWay_GetDataS2D = 0x0402,

Cmd_ComputerSoftwareGateWay_SendDataS2C = 0x8400,
Cmd_ComputerSoftwareGateWay_SendDataC2S = 0x8401,
Cmd_ComputerSoftwareGateWay_GetDataC2S = 0x8402,

Cmd_DeviceNumOnlineNum_S2D_Get = 0x0410,
Cmd_DeviceNumOnlineNum_D2S_Update = 0x0411,
Cmd_ButtonEvent_S2D_Set = 0x0412,

Cmd_ButtonName_S2D_Get = 0x0413,
Cmd_ButtonName_D2S_Update = 0x0414,

Cmd_DeviceNumOnlineNum_C2S_Get = 0x8410,
Cmd_DeviceNumOnlineNum_S2C_Update = 0x8411,
Cmd_ButtonEvent_C2S_Set = 0x8412,

Cmd_ButtonName_C2S_Get = 0x8413,
Cmd_ButtonName_S2C_Update = 0x8414,

//节目配置
Cmd_ComputerSoftwareGateWay_Program_ConfigD_S_update = 0x0403,  //上报节目配置
Cmd_ComputerSoftwareGateWay_Program_ConfigS_D_set = 0x0405,

Cmd_ComputerSoftwareGateWay_Program_ConfigS_C_update = 0x8403,
Cmd_ComputerSoftwareGateWay_Program_ConfigC_S_Get = 0x8404,
Cmd_ComputerSoftwareGateWay_Program_ConfigC_S_Set = 0x8405,
//节目状态
Cmd_ComputerSoftwareGateWay_Program_StatusD_S_update = 0x0406,            //上报状态；
Cmd_ComputerSoftwareGateWay_Program_IndexS_D_Modify = 0x0408,			//修改节目；
Cmd_ComputerSoftwareGateWay_Program_Mode_S_D_Modify = 0x0409,			//修改节目模式；

Cmd_ComputerSoftwareGateWay_Program_StatusS_C_update = 0x8406,          //查询节目状态；
Cmd_ComputerSoftwareGateWay_Program_StatusC_S_Get = 0x8407,          //查询节目状态；
Cmd_ComputerSoftwareGateWay_Program_IndexC_S_Modify = 0x8408,			//修改节目；
Cmd_ComputerSoftwareGateWay_Program_Mode_C_S_Modify = 0x8409,		   //修改节目模式；

//音量配置
Cmd_ComputerSoftwareGateWay_Sound_Config_D_S_update = 0x040A,			//上报音量配置；
Cmd_ComputerSoftwareGateWay_Sound_Config_D_S_Set = 0x040C,			//设置音量配置；

Cmd_ComputerSoftwareGateWay_Sound_Config_S_C_update = 0x840A,		    //上报音量配置；
Cmd_ComputerSoftwareGateWay_Sound_Config_C_S_Get = 0x840B,				//查询音量配置；
Cmd_ComputerSoftwareGateWay_Sound_Config_C_S_Set = 0x840C,				//设置音量配置；

//音量状态
Cmd_ComputerSoftwareGateWay_Sound_Status_D_S_update = 0x040D,			//上报音量状态；
Cmd_ComputerSoftwareGateWay_Sound_Status_D_S_Set = 0x040F,					//设置音状态；

Cmd_ComputerSoftwareGateWay_Sound_Status_C_S_update = 0x840D,		    //上报音量状态；
Cmd_ComputerSoftwareGateWay_Sound_Status_C_S_Get = 0x840E,				//查询音量状态；
Cmd_ComputerSoftwareGateWay_Sound_Status_C_S_Set = 0x840F,					//设置音量状态；

Cmd_Device_Reset_S2D = 0x00F0,
Cmd_Device_Reset_C2S = 0x80F0,

//投影DMX 
Cmd_DMX_S2D_Send = 0X0319,
Cmd_DMX_S2D_Get = 0X031A,

Cmd_DMX_C2S_Send = 0X8319,
Cmd_DMX_C2S_Get = 0X831A,

//电源网关DMX
Cmd_DMXPowerGateway_S2D_Send = 0X0220,

Cmd_DMXPowerGateway_S2D_Get = 0X0221,

Cmd_DMXPowerGateway_C2S_Send = 0X8220,

Cmd_DMXPowerGateway_C2S_Get = 0X8221,

Cmd_TempManual_S2D_Set = 0x0222,
Cmd_TempManual_D2S_Update = 0x0223,
Cmd_TempManual_S2D_Get = 0x0224,

Cmd_TempManual_C2S_Set = 0x8222,
Cmd_TempManual_S2C_Update = 0x8223,
Cmd_TempManual_C2S_Get = 0x8224,


Cmd_TempManual035_S2D_Set			= 0x031B,
Cmd_TempManual035_D2S_Update	= 0x031C,
Cmd_TempManual035_S2D_Get			= 0x031D,

Cmd_TempManual035_C2S_Set			= 0x831B,
Cmd_TempManual035_S2C_Update	= 0x831C,
Cmd_TempManual035_C2S_Get			= 0x831D,

    
	Cmd_OnOffSendSingle_S2D_Set = 0x031E,
	Cmd_OnOffSendSingle_C2S_Set = 0x831E,

	Cmd_ComputerSoftwareGateWay_Anomalous_D2S_Update = 0x0415,
	Cmd_ComputerSoftwareGateWay_Anomalous_S2C_Update = 0x8415,

Cmd_ModifyPwd_IOT = 0x9000,					//用户修改密码     
Cmd_GetExsitLoginUser_IOT,
Cmd_GetUserListPage_IOT,
Cmd_ApproveUser_IOT,
Cmd_ModifyUser_IOT,
Cmd_GetLogPage_IOT,
Cmd_ProjectAdd_IOT,										//项目增加
Cmd_ProjectDelete_IOT,									//项目删除
Cmd_ProjectModify_IOT,								//项目修改
Cmd_ProjectGetList_IOT,								//获取项目列表
Cmd_LogGetList_IOT,										//查询设备日志
Cmd_ExpectionGetList_IOT,

Cmd_DeviceGetList_IOT,								//查询设备列表
Cmd_DeviceAdd_IOT,										//设备添加
Cmd_DeviceModify_IOT,								//设备修改
Cmd_DeviceDelete_IOT,									//设备删除
Cmd_DevTypeGetList_IOT,							//获取设备类型列表
Cmd_CmdTypeGetList_IOT,							//获取命令类型列表
Cmd_DeviceGetState_IOT,

Cmd_Device_NewNotify_IOT,
Cmd_Device_OnlineNotify_IOT,
Cmd_Device_OfflineNotify_IOT,

Cmd_SuperUserProjectAdd,							//超级用户添加项目；
Cmd_SuperUserProjectModify,						//修改项目；
Cmd_SuperUserProjectDelete,						//删除项目； 
Cmd_GetProjectList,											//获取项目列表；
Cmd_GeneralUserJoinProject,						//普通用户加入项目；
Cmd_DeviceAddToProject,								//设备添加到；

Cmd_UserOperateGetUserTypeList,				//获取用户类型列表（不用的接口）
Cmd_UserOperateGetUesrList,						//获取用户列表
Cmd_UserOperateVerifyUser,							//审核用户,审核为系统管理员或超级用户
Cmd_UserOperateModifyUser,						//修改用户密码，启用或禁用
Cmd_ClientCheckVersion,								//客户端检测当前版本
Cmd_GetUserLog,												//获取用户日志；
Cmd_Logout,														//用户注销
Cmd_Server2UserLogout,								//用户注销
Cmd_UserAdd,													//增加用户
Cmd_UserBindToProject,									//用户和项目绑定

Cmd_MoveDeviceToProject,							//移动设备
Cmd_GetExpectionSendMail,							//查询异常，发送电子邮寄给管理员

Cmd_GetMailUserList,										//获取邮件接收列表；
Cmd_SetMailUserList,										//设置邮件接收列表；

Cmd_GetDeviceStatusCurrent,						//获取设备当前温度和湿度；
Cmd_GetDeviceStatusList,								//获取设前温度和湿度列表；
Cmd_GetDeviceStatusMax_Min_avg,			//获取设备温度湿度的最大值，最小值，平均值；
Cmd_SetDeviceStatusProjectSaveTime,		//设置某个项目最长保留时间；

Cmd_ApplyJoinProject,										//申请加入项目
Cmd_GetApplyListCount,								//分页查询申请加入列表
Cmd_GetApplyList,											//分页查询申请加入列表
Cmd_ApproveUserJoin,									//审核用户加入
Cmd_InviteUser,													//邀请用户加入（拉人进项目）
Cmd_GetProjectListCanJoinApply,				//查询可以加入的部门列表
Cmd_GetMyApplyProjectList,							//查询已申请的列表
Cmd_GetProjectUserList,									//查询项目已有用户In{pid}
Cmd_UserMoveOutProject,								//移除项目中的一个用户In:{pid,username}
Cmd_DeviceHeartError,									//设备心跳包异常记录
Cmd_ResetPwdAdmin,										//管理员重置密码
Cmd_SubscribeMessageAdd,							//消息订阅；
Cmd_SubscribeMessageCancle,						//取消订阅；
Cmd_ModifyUserAuther,									//修改用户权限；
Cmd_Device_OfflineLoginNotify_S2C,		//设备离线通知订阅的客户端
Cmd_Get_DeviceStatusListMessage,				//查询投影网关列表消息相关
Cmd_GetLogAll,
Cmd_GetProjectListAdmin,								//管理员查看用户有哪些项目参数{userid}
Cmd_ModifyUserType,										//修改用户类型；
Cmd_Get_DeviceStatusListMessageNew,	//-------------查询曲线相关关列表消息；新增设备类型json{DevType}
Cmd_Push_DeviceStatusListMessage,			//表格生成完毕，发一个订阅类型的消息；
Cmd_DeviceStatusListMessageNotify,			//表格生成完毕

Cmd_GetLogAllFile,											//--------------查询日志文件；新增设备类型json{logguid}
Cmd_Push_DeviceLogMessage,						//表格生成完毕，发一个订阅类型的消息；
Cmd_DeviceLogListMessageNotify,				//日志表格生成完毕
Cmd_UserSetMeEmail,										//用户设置自己的邮箱

Cmd_SendToModuleDownLoad,						//发送投影或者电源网关曲线参数给模块

Cmd_LocalMouleLogin,									//模块登录，开启接受线程；
Cmd_MapPosSet,												//设置项目的地点；经纬度
Cmd_MapPosGet,												//获取项目的地点；经纬度
Cmd_LoginMoible,												//手机端登录；
Cmd_GisGetAllInfo,
Cmd_SubscribeMessageAddM,							//消息订阅；
Cmd_SubscribeMessageCancleM,						//取消订阅；
Cmd_UserPetNameSet,										//修改用户昵称；
Cmd_DocAdd,														//文档增加 {name扩展名}
Cmd_DocDelete,													//文档删除 {name扩展名}
Cmd_DocGetListCount,										//获取文档的数量；返回{count}
Cmd_DocGetList,													//文档获取列表{PageNumber,PageSize}  ->{count,list{name}}
	/**********************************
	* 文档管理相关接口
	**********************************/
	
	Cmd_DirAdd,														//目录增加 {name扩展名}，不能重名
	Cmd_DirDelete,													//目录删除 {id}，有文档的不能删除
	Cmd_DirGetListCount,										//获取当前目录文档的数量；返回{count}
	Cmd_DirGetList,													//获取当前目录文档的列表{PageNumber,PageSize}  ->{count,list{name}}
	
	Cmd_EmaiTypeListGet,											//查询订阅类型列表list{{id,name,value,role}}						  role为0设备，   为1用户
Cmd_EmaiTypeListGetSubscirbe ,							//查询已经订阅的类型list{{id, userID,type_id,guid,role}}	  用户的guid传0   role为0设备， 为1用户
Cmd_subscribeEmail,												//新增订阅{type_id=1, add=0/1,guid,role}							  用户的guid传0   role为0设备， 为1用户
Cmd_EmailOnOff,		
Cmd_ComputerSoftwareGateWay_Anomalous_C2S_Get,//查询异常list{ } 
Cmd_AnomalousProject_C2S_Get,									//查询异常部门{ id, dname} 
//一键发布功能相关
Cmd_OneKeyAdd_C2S,                                                 //新增一个执行主题	{pid,name }  返回{id}
Cmd_OneKeyBind_C2S,												 //{id, md5}
Cmd_OneKeyDelete_C2S,                                             //删除一个执行主题	{id}
Cmd_OneKeyModify_C2S,                                            //修改主题名称{id,newname}
Cmd_OneKeyListGetCount_C2S,                                  //获取当前项目主体数量；返回{count}
Cmd_OneKeyListGet_C2S,											 //查询主题列表in:pid, out:list{id,pid,name,md5}
Cmd_OneKeyRun_C2S,												 //运行主题{id},
Cmd_OneKeyRun_S2M,												 //运行主题{id}
Cmd_OneKeyFinishNotify_M2S,									 //完成通知，模块通知服务器;
Cmd_OneKeyFinishNotify_S2C	,								 //完成通知，服务器通知客户端;


Cmd_SendMessage,
Cmd_Ping,
Cmd_GetFileBuffer,
cmd_send_upgrade_c2s,
cmd_send_upgrade_s2d,
cmd_send_text_c2s,
cmd_send_text_s2d,
cmd_passThrough_c2s,
cmd_passThrough_s2d,

cmd_alarm_threshold_set_h2s, //http服务器发送到IOT服务器，设置报警阀 ，开关状态，超过最大值，低于最小值 需回复
cmd_upload_interval_set_h2s, //设置上报间隔 需回复
cmd_decimal_count_set_h2s,   //  需回复

cmd_alarm_threshold_set_s2d, //IOT服务器到设备，设置报警阀 ，开关状态，超过最大值，低于最小值
cmd_upload_interval_set_s2d, //设置上报间隔
cmd_decimal_count_set_s2d,   // 
cmd_device_online_get_h2s,        // http->IOT{count:100，data:[]} 查询设备在线状态； 一次最多查100个设备；返回{}
cmd_upload_temp_hum,
cmd_notify_httpserver_s2h,       //通知python执行脚本，建立数据表
cmd_config_get_d2s,               //获取基本配置
cmd_alarm_d2s,
cmd_alarm_s2c,
cmd_upload_reason_d2s
};
typedef enum _CMD_TYPE_IOT CMD_TYPE_IOT;

typedef  enum  error_Code_IOT
{
	CODE_Succese_IOT = 200,		//成功
	code_Faild_IOT,				//失败
	Code_UserExist_IOT,			//用户名已存在;
	Code_ErrorInvade_IOT,		//邀请码输入有误;
	code_baseError_IOT,			//数据库需升级
	Code_ErrorInfo_IOT,			//错误的用户或密码
	Code_UserNotExist_IOT,		//用户不存在
	Code_DeviceGuidExist_IOT,	//设备GUID已存在
	code_DeviceFaild_IOT,		//从设备获取失败
	code_DeviceOffline_IOT,		//设备离线
	code_NetError_IOT, 			//网络错误
	code_ConnectError_IOT,		//连接服务器失败
	code_JsonError_IOT,			//json数据非法
	code_LenthError_IOT,	//长度非法
	code_ProjectNameExist_IOT,  //已经存在的项目名称
	code_ProjectGuidExist_IOT,	//已经存在的项目guid
	code_baseNotConnnect_IOT,   //数据库连接错误
	code_DevicePwdError_IOT,    //设备密码错误
	code_ProjectHaveDevice_IOT, //项目下有设备，不能删除
	code_RegisterRejectTime,    //一个IP地址一段时间内限制注册多个
	Code_DeviceNotExist_IOT,    //设备不存在
	Code_Permission_ERROR,      //权限不足
	Code_OldPwd_ERROR,          //旧密码验证失败
	Code_EmptyProjectExist,     //已有空项目未使用
	Code_UserHaveLogin,         //用户已登录
	Code_UserNoLogin,           //用户未登录，禁止操作；
	Code_DecryFailed,           //加密数据无效；
	Code_DataOutOffTime,         //数据过期；
	Code_UserHaveJoinProject,    //用户已加入该项目
	Code_UserHaveApplyJoin,      //用户已申请加入该项目，待审核
	Code_OperaterDeny,           //不允许的操作
	Code_CSV_Exsit,            //请求的设备日期csv存在
	Code_CSV_NotExsit,            //请求的设备日期csv不存在
	Code_CSV_Creating,            //csv生成中；
	code_HaveLock,					  //该路继电器 已经上锁
	code_unLockNotAuther,     //无权限解锁 该路继电器
	code_CreateAgain,               //重新生成，已有状态为1的；
	code_CreateIng,		              //正在生成;状态为0的
	code_KeyValueNotExsit		              //正在生成;状态为0的 
}Error_Code_IOT;


struct Log_Device
{
	UINT	uCmd;
	UINT	uDevType;
	UINT	Guid;
	int		nNormal;
	int     code;
	int		nLogUserId;
	char	strPara[128];
	char	strContent[512];
	char   strOld[32];
	char   strNew[32];
};

#endif